﻿using System;
using System.Collections.Generic;
using System.Linq;
using studentSubsidy.Entity.Details;
using studentSubsidy.Entity.Home;
using studentSubsidy.Models;
using studentSubsidy.Utils;

namespace studentSubsidy.Dao
{
    public class DetailsDao
    {
        private MyDbContext DbContext = new MyDbContext();

        public Project getDetails(DetailsQuery detailsQuery)
        {
            List<Project> projects = DbContext.Project.Where(p => p.product_id == detailsQuery.product_id).ToList();
            return projects[0];
        }

        public string getDetailsPicture(DetailsQuery detailsQuery)
        {
            var picture = DbContext.Project.Where(p => p.product_id == detailsQuery.product_id)
                .Select(p => new string(p.product_picture)).ToList();
            return picture.First().ToString();
        }
    }
}